<?php

namespace Biz\model\GoodsTestActivity;


class FineGoodsMsgModel extends \Doraemon\pockets\datebase\BaseDbModel
{
    public const _CONFIG_FILE_ = 'db_store';

    public const _CONFIG_SELECT_ = 'db_brand_activity';

    public const _DATABASE_ = 'brand_activity';

    public const _TABLE_NAME = 'fine_goods_test_activity_msg';

    //消息类型 1：完成申请,2:获得名额,3:完成许愿
    public const MSG_APPLY = 1;
    public const MSG_SUCCESS = 2;
    public const MSG_WISH = 3;

    /**
     * 获取一行
     * @param $where
     * @param string $field
     * @return array|mixed|null
     */
    public static function first($where, $field = '*')
    {
        $rs = self::get($field, $where);
        if (!$rs) {
            return null;
        }
        return $rs;
    }

    /**
     * 批量查询
     * @param $where
     * @param  $field
     * @return array|bool
     */
    public static function all($where, $field = '*')
    {
        return self::select($field, $where);
    }

    /**
     * 获取一列的值
     * @param $where
     * @param array $field
     * @return array|bool
     */
    public static function pluck($where, array $field = ['id'])
    {
        return self::select($field, $where);
    }

    /**
     * 从记录中获取单个值
     * @param $where
     * @param string $columns
     * @return array|bool
     */
    public static function value($where, string $columns = 'id')
    {
        return self::get($columns, $where);
    }



}